package demo2;

public class Computer {
    public void useDevice(IUSB usb) {
        usb.openDevice();
        if (usb instanceof Mouse) {
            ((Mouse) usb).click();
        }else if(usb instanceof KeyBoard) {
            ((KeyBoard) usb).inPut();
        }
        usb.closeDevice();
    }
}
